#pragma once

#include <vector>
#include "BWAPI.h"

using namespace BWAPI;

class VitalZone
{
	std::vector<Position> polygon;
	Position centroid;
	double area;
public:
	bool VitalZone::containsPoint(Position point,int skip=-1);
	void addPoint(Position point);
	Position closestPoint(Position point);

	inline Position getCentroid() { return centroid; }
	inline double getArea() { return area; }
	inline std::vector<Position>* getPolygon() { return &polygon; }
};

class BuildingPlacer
{
	friend class VZManager;
	std::vector<VitalZone> vitalZones; // Structures cannot be placed in vital zones
public:
	// width, height, and padding are measured in tiles.
	TilePosition getClosestFit(Point<int, 32> point, UnitType utype, double radius, int padding=1);
	VitalZone* addVitalZone(VitalZone& zone, Color color = Colors::Orange); // Orange => do not draw bc orange sucks
};
